package cc.xpcas.raft;

import lombok.Data;

/**
 * @author xp
 */
@Data
public class LogEntry {

    private long id;

    private long term;

    private long timestamp;

    private LogData data;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof LogEntry)) return false;

        LogEntry entry = (LogEntry) o;

        if (id != entry.id) return false;
        return term == entry.term;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + (int) (term ^ (term >>> 32));
        return result;
    }
}
